﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Cat
    {
        private string name;
        public Cat(string name)
        {
            this.name = name;
        }
        /// <summary>
        /// sender:发送通知的对象；args：包含所有接收对象的通知信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public delegate void CatShoutEventHandler(object sender, CatShoutEventArgs args);
        public event CatShoutEventHandler CatShout;
        public void Shout()
        {
            Console.WriteLine("喵，我是{0}", name);
            if (CatShout != null)
            {
                CatShoutEventArgs e = new CatShoutEventArgs();
                e.Name = this.name;
                CatShout(this, e);
            }
        }
    }
}
